package org.jeecg.modules.monitoring.j_monitoring.entity.software;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 软件证书设置
 * @Author: xiaoyq
 * @Date:   2023-10-12
 * @Version: V1.0
 */
@Data
@TableName("software_setting")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="软件证书设置", description="软件证书设置")
public class SoftwareSetting implements Serializable {
    private static final long serialVersionUID = 1L;
    /**id*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "id")
    private Integer id;
    /**softwarename*/
    @Excel(name = "softwarename", width = 15)
    @ApiModelProperty(value = "softwarename")
    @TableField(value = "softwarename")
    private String softwarename;
    /**softwarecompany*/
    @Excel(name = "softwarecompany", width = 15)
    @ApiModelProperty(value = "softwarecompany")
    @TableField(value = "softwarecompany")
    private String softwarecompany;
    /**describe*/
    @Excel(name = "描述", width = 15)
    @ApiModelProperty(value = "描述")
    @TableField(value = "remarks")
    private String remarks;
    /**type*/
    @Excel(name = "type", width = 15)
    @ApiModelProperty(value = "type")
    @TableField(value = "Type")
    private String type;
    /**softwarechinesename*/
    @Excel(name = "softwarechinesename", width = 15)
    @ApiModelProperty(value = "softwarechinesename")
    @TableField(value = "softwarechinesename")
    private String softwarechinesename;


    @Excel(name = "是否显示", width = 15)
    @ApiModelProperty(value = "是否显示")
    @TableField(value = "isshow")
    private Integer isshow;

    @Excel(name = "序号", width = 15)
    @ApiModelProperty(value = "序号")
    @TableField(value = "sort_no")
    private Double sortNo;


    /**创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "createtime")
    private Date createtime;

    /**创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;

    //0：初始状态，1：表示存在，2：不存在（需要删除）、3：刚新增
    @ApiModelProperty(value = "状态")
    @TableField(value = "Status")
    private String Status;

    @ApiModelProperty(value = "是否删除")
    @TableField(value = "Is_Deleted")
    private String IsDeleted;

    public static SoftwareSetting from(LicenseSoftware entity){
        SoftwareSetting setting = new SoftwareSetting();
        setting.setId(entity.getId());
        setting.setSoftwarename(entity.getSoftwarename());
        setting.setSoftwarecompany(entity.getSoftwarecompany());
        setting.setRemarks(entity.getDescribe());
        setting.setType(entity.getType());
        setting.setSoftwarechinesename(entity.getSoftwarechinesename());
        setting.setIsshow(0);
        setting.setStatus("3");

        return setting;
    }

    public void copy(LicenseSoftware entity){
        SoftwareSetting setting = this;
        setting.setId(entity.getId());
        setting.setSoftwarename(entity.getSoftwarename());
        setting.setSoftwarecompany(entity.getSoftwarecompany());
        setting.setRemarks(entity.getDescribe());
        setting.setType(entity.getType());
        setting.setSoftwarechinesename(entity.getSoftwarechinesename());
    }
}
